<?php

namespace App\Http\Requests\Admin;


class UserRequest extends Request
{


    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|min:3',
            'email' => 'required|email|unique:users,email',
            'password' => 'required|min:6|confirmed',
            'password_confirmation' => 'required'
        ];
    }

    public function messages()
    {
        return [
            'name.required'=>"名称必须",
            'name.min'=>'名称不能少于三个字符串',
            'email.required'=>'邮箱必须',
            'email.email'=>"邮箱格式不正确",
            'email.unique'=>'邮箱已存在',
            'password.required'=>'密码必须',
            'password.min'=>"密码不能少于6个字符串",
            'password.confirmed'=>'两次输入密码不一致',
            'password_confirmation.required'=>'确认密码必须',
        ];
    }
}
